package cn.sixmillions.ps.service.impl;

import cn.hutool.core.lang.ObjectId;
import cn.hutool.core.util.IdUtil;
import cn.sixmillions.ps.entity.MdPreview;
import cn.sixmillions.ps.mapper.MdPreviewMapper;
import cn.sixmillions.ps.service.IMdPreviewService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * markdown预览(TtMdPreview)表服务实现类
 *
 * @author six
 * @since 2023-01-12
 */
@Service("mdPreviewService")
public class MdPreviewServiceImpl extends ServiceImpl<MdPreviewMapper, MdPreview> implements IMdPreviewService {

    @Override
    public MdPreview saveOneMd(MdPreview mdPreview) {
        mdPreview.setMdId(ObjectId.next())
                .setMdSecret(IdUtil.simpleUUID())
                .setCreatedBy("sys")
                .setLastModifiedBy("sys");
        this.save(mdPreview);
        //减少传输压力
        return mdPreview.setMdContent("");
    }
}

